home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 62
/
Volume 62 - JOGO DISK .iso
/
Games
/
room-maker.swf
/
scripts
/
frame_12
/
DoAction.as
Wrap
Text File
|
2008-03-17
|
9KB
|
359 lines
function doMenuAction(itemNum)
{
if(itemNum == 0)
{
attachSubmenu("w",0);
}
else if(itemNum == 1)
{
attachSubmenu("b",1);
}
else if(itemNum == 2)
{
attachSubmenu("f",2);
}
else if(itemNum == 3)
{
attachSubmenu("c",3);
}
else if(itemNum == 4)
{
attachSubmenu("t",4);
}
else if(itemNum == 5)
{
attachSubmenu("s",5);
}
else if(itemNum == 6)
{
attachSubmenu("n",6);
}
else if(itemNum == 7)
{
attachSubmenu("r",7);
}
}
function attachSubmenu(item, itemnum)
{
if(!_root.mc_hittester.hitTest(_root.help))
{
var roomStuffDrag = true;
_root.createEmptyMovieClip("container",0);
_root.container._x = xPos[itemnum];
_root.container._y = yPos;
_root.container.attachMovie("submenu","submenu",1);
_root.container.submenu._x = xInPos;
_root.container.submenu._y = yInPos;
_root.container.submenu._alpha = 80;
var k = 1;
i = 0;
while(i < Hor)
{
j = 0;
while(j < Ver)
{
_root.container.submenu.attachMovie(item + k,item + k,k + 100);
newmc = item + k;
_root.container.submenu[newmc]._xscale = 28;
_root.container.submenu[newmc]._yscale = 28;
_root.container.submenu[newmc]._x = i * xInc + xOffset;
_root.container.submenu[newmc]._y = j * yInc + yOffset;
_root.container.submenu[newmc].onRollOver = function()
{
this._xscale = 60;
this._yscale = 60;
};
_root.container.submenu[newmc].onRollOut = function()
{
this._xscale = 28;
this._yscale = 28;
};
k++;
j += 1;
}
i += 1;
}
}
}
function catchMe(myNum, myName, myCat)
{
if(!_root.mc_hittester.hitTest(_root.room["a" + myName]))
{
trace("myNum " + myNum + " myName " + myName + " myCat " + myCat);
if(myCat == "n")
{
counterCats[0] = counterCats[0] + 1;
trace(counterCats[0] + " nature");
}
else if(myCat == "t")
{
counterCats[1] = counterCats[1] + 1;
trace(counterCats[1] + " tr");
}
else if(myCat == "a")
{
counterCats[2] = counterCats[2] + 1;
trace(counterCats[2] + " ad");
}
else if(myCat == "s")
{
counterCats[3] = counterCats[3] + 1;
trace(counterCats[3] + " sp");
}
else if(myCat == "e")
{
counterCats[4] = counterCats[4] + 1;
trace(counterCats[4] + "ent");
}
NameString = myName.charAt(0);
levelNum = 0;
if(NameString == "w")
{
levelNum = 400;
}
else if(NameString == "b")
{
levelNum = 450;
}
else if(NameString == "c")
{
levelNum = 500;
}
else if(NameString == "t")
{
levelNum = 550;
}
else if(NameString == "f")
{
levelNum = 600;
}
else if(NameString == "s")
{
levelNum = 650;
}
else if(NameString == "n")
{
levelNum = 700;
}
else if(NameString == "r")
{
levelNum = 750;
}
_root.room.attachMovie("a" + myName,"a" + myName,myNum + levelNum);
if(NameString == "w")
{
_root.room["a" + myName].gotoAndStop("room2");
}
}
currentClip = _root.room["a" + myName];
currentClip._x = myNum - 120;
currentClip._y = myNum;
currentClip.onPress = currentClip.onDragOver = currentClip.onDragOut = function()
{
trace("pressing the current clip");
var my_x = _root.dummy._x;
var my_y = _root.dummy._y;
var mar1 = _root.frame._width / 2;
var mar2 = _root.frame._height / 2;
var left = my_x - mar1;
var right = my_x + mar1;
var top = my_y - mar2;
var bottom = my_y + mar2;
if(!_root.mc_hittester.hitTest(_root.help))
{
startDrag(this,1,left,top,right,bottom);
_root.x += 2;
this.swapDepths(_root.x);
}
};
currentClip.onRollOver = function()
{
if(!_root.mc_hittester.hitTest(_root.help))
{
_root.x += 2;
this.swapDepths(_root.x);
}
};
currentClip.onRelease = function()
{
stopDrag();
};
currentClip.onEnterFrame = function()
{
if(_root.mc_hittester.hitTest(_root.help))
{
this.onRelease = function()
{
trace("hittester is touching the help");
stopDrag();
};
}
if(roomStuffDrag == false)
{
stopDrag();
this.onRollOver = this.onReleaseOutside = this.onPress = this.onRelease = this.onDragOver = this.onDragOut = function()
{
stopDrag();
};
}
if(this.hitTest(_root.trashcan.hotspot))
{
stopDrag();
_root.trashcan.gotoAndStop("animate");
removeMovieClip(this);
_root.s6.start();
if(myCat == "n")
{
counterCats[0]--;
trace(counterCats[0] + " nature");
}
else if(myCat == "t")
{
counterCats[1]--;
trace(counterCats[1] + " tr");
}
else if(myCat == "a")
{
counterCats[2]--;
trace(counterCats[2] + " adv");
}
else if(myCat == "s")
{
counterCats[3]--;
}
else if(myCat == "e")
{
counterCats[4]--;
}
}
};
}
function calculateCats()
{
var max = 0;
maxCats = new Array();
i = 0;
while(i < counterCats.length)
{
if(counterCats[i] > max)
{
max = counterCats[i];
maxCats = new Array();
trace(max + " max");
maxCats[0] = catNames[i];
}
else if(counterCats[i] == max)
{
maxCats[maxCats.length++] = catNames[i];
trace(maxCats);
}
i++;
}
var maxCatsSum = 0;
i = 0;
while(i < counterCats.length)
{
maxCatsSum += counterCats[i];
i++;
}
if(maxCats.length > 1 && maxCats.length < 3)
{
roomStuffDrag = false;
file = "eclectic1.txt";
displayText(file);
}
else if(maxCatsSum == 0)
{
_root.attachMovie("playAgain","playAgain",900);
roomStuffDrag = true;
_root.playAgain._x = 295;
_root.playAgain._y = 245;
_root.playAgain._alpha = 80;
}
else if(maxCats.length > 2 && maxCats.length < 3)
{
roomStuffDrag = false;
file = "eclectic2.txt";
displayText(file);
}
else if(maxCats.length > 3)
{
roomStuffDrag = false;
file = "eclectic3.txt";
displayText(file);
}
else
{
file = String(maxCats[0]) + ".txt";
roomStuffDrag = false;
displayText(file);
}
}
function displayText(file)
{
loadText = new loadVars();
loadText.load(file);
loadText.onLoad = function(success)
{
if(success)
{
_root.designProfile.html = true;
_root.designProfile.htmlText = this.myNews;
}
};
}
stop();
_root.empty_box._visible = false;
_root.frame._visible = false;
_root.movearea._visible = false;
_root.room._x = _root.frame._x;
_root.room._y = _root.frame._y;
_root.room.attachMovie("room2","room2",1);
_root.room.room2.gotoAndStop("intro");
counterCats = [0,0,0,0,0];
catNames = ["nature","travel","adventure","sports","entertainment"];
init();
var yPos = 134;
var Hor = 5;
var Ver = 4;
var xInc = 72;
var yInc = 70;
var xInPos = 0;
var yInPos = 0;
var xOffset = 50;
var yOffset = 50;
xPos = [295,295,230,365,365,365,365,365];
this.onEnterFrame = function()
{
help.help_btn.onPress = function()
{
removeMovieClip("container");
};
ratio.text = mySlider.ratio;
var slider = ratio.text;
if(Key.isDown(13))
{
mySlider.line._xscale = lineLength.text;
}
var aa = 7.142857142857143;
var i = 1;
while(i <= 14)
{
if(slider < i * aa && slider >= (i - 1) * aa)
{
var mystep = "p" + i;
_root.room.room2.gotoAndStop(mystep);
}
i++;
}
};
var string = "";
var levelNum = 0;
finish_btn.onRelease = function()
{
calculateCats();
removeMovieClip("container");
removeMenu();
_root.gotoAndStop("#p");
};